Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

434
Views
Discord.js error "TypeError: channel.updateOverwrite is not a function"

When I'm trying to change the channel permissions to lock users from sending messages, this error pops up no matter what I do.

TypeError: channel.updateOverwrite is not a function

Is there anything wrong?

module.exports =
{
    async execute(message, args)
    {
            const role = message.guild.roles.cache.find(r => r.name === '@everyone')

            let channel = message.mentions.channels.first() || args[0]
            if(!channel) channel = message.channel

            if(channel.permissionsFor(message.guild.id).has('SEND_MESSAGES') === false) return message.channel.send(`${channel} is already locked.`)

            await channel.updateOverwrite(message.guild.id, { SEND_MESSAGES: false }).catch(() => {}) // Line in which the error happens
            await channel.updateOverwrite(role, { SEND_MESSAGES: false} ).catch(() => {})
    }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It seems you're using discord.js v13 but using some old code. In v13 the channel#updateOverwrite() method is removed and while in previous version channel#permissionOverwrites was a collection of overwrites, in v13 it's a PermissionOverwriteManager. It means, you should use its .edit() method to update overwrites:

await channel
  .permissionOverwrites.edit(message.guild.id, { SEND_MESSAGES: false })
await channel
  .permissionOverwrites.edit(role, { SEND_MESSAGES: false })
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!